<%@page contentType="text/html; charset=utf-8"%>
<html>
    <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
	<script type="text/javascript">
		$(function(){
			//jquery选择器
			var i = 0;
			$("input[type='button']").click(function(){
				$("input[type='text']").each(function(){
					i=i+parseInt($(this).val());
				});
				$("label").text(i);   //i的值是3;
			});
			alert(i);   //此时i的值是0;
			$("input:lt(2)").add('label').css('border','none').css('borderBottom','solid 1px navy')
			.css({'width':'30px'});
		});
	</script>
	<input value="1" id = "val1">+<input value="2" id = "val2">
	<input type="button" value="=" id="btn">
	<label>&nbsp;</label>
	<%--<script type="text/javascript">
		$("#btn").click(function(){
			alert("ok");
		});
	</script>
--%>
</html>